package de.eridea.learning.java.usermanagement.logic.to;

import java.util.Set;

/**
 * @author frank
 * 
 */
public class ResourceDataImpl implements ResourceData, ResourceDataEditable,
		ResourceDataLinked {

	private final String resourceIdentifier;
	private final Set<GroupData> permittedGroups;
	private UserData owner;

	public ResourceDataImpl(String resourceIdentifier,
			Set<GroupData> permittedGroups) {
		if (resourceIdentifier == null) {
			throw new NullPointerException(
					"resourceIdentifier must not be null");
		}
		if (permittedGroups == null) {
			throw new NullPointerException("permittedGroups must not be null");
		}
		this.permittedGroups = permittedGroups;
		this.resourceIdentifier = resourceIdentifier;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see de.eridea.learning.java.usermanagement.logic.to.ResourceData#
	 * getResourceIdentifier()
	 */
	public String getResourceIdentifier() {
		return resourceIdentifier;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see de.eridea.learning.java.usermanagement.logic.to.ResourceData#
	 * getPermittedGroups()
	 */
	public Set<GroupData> getPermittedGroups() {
		return permittedGroups;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * de.eridea.learning.java.usermanagement.logic.to.ResourceData#getOwner()
	 */
	public UserData getOwner() {
		return owner;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * de.eridea.learning.java.usermanagement.logic.to.ResourceData#setOwner
	 * (de.eridea.learning.java.usermanagement.logic.to.UserData)
	 */
	public void setOwner(UserData owner) {
		if (owner == null) {
			throw new NullPointerException("owner must not be null");
		}
		this.owner = owner;
	}

}
